# database_config.py
from dataclasses import dataclass

@dataclass
class DatabaseConfig:
    """数据库配置"""
    host: str = 'localhost'
    port: int = 5432
    database: str = 'postgres'
    user: str = 'admin'
    password: str = 'pg123456'
    schema: str = 'public'
    pool_size: int = 20
    max_overflow: int = 20
    pool_timeout: int = 30
    pool_recycle: int = 1800
    
    @property
    def connection_string(self) -> str:
        return (
            f"postgresql://{self.user}:{self.password}@"
            f"{self.host}:{self.port}/{self.database}"
        )